package iwpl.project.entities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * EquipmentDetails entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "EquipmentDetails")
public class EquipmentDetails implements java.io.Serializable {

	// Fields

	private Integer id;
	private Equipments equipments;
	private Apartments apartments;
	private Set<EquipmentHistories> equipmentHistorieses = new HashSet<EquipmentHistories>(
			0);

	// Constructors

	/** default constructor */
	public EquipmentDetails() {
	}

	/** minimal constructor */
	public EquipmentDetails(Integer id) {
		this.id = id;
	}

	/** full constructor */
	public EquipmentDetails(Integer id, Equipments equipments,
			Apartments apartments, Set<EquipmentHistories> equipmentHistorieses) {
		this.id = id;
		this.equipments = equipments;
		this.apartments = apartments;
		this.equipmentHistorieses = equipmentHistorieses;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "EquipmentID")
	public Equipments getEquipments() {
		return this.equipments;
	}

	public void setEquipments(Equipments equipments) {
		this.equipments = equipments;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ApartmentID")
	public Apartments getApartments() {
		return this.apartments;
	}

	public void setApartments(Apartments apartments) {
		this.apartments = apartments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "equipmentDetails")
	public Set<EquipmentHistories> getEquipmentHistorieses() {
		return this.equipmentHistorieses;
	}

	public void setEquipmentHistorieses(
			Set<EquipmentHistories> equipmentHistorieses) {
		this.equipmentHistorieses = equipmentHistorieses;
	}

}